<?php
include_once("lib/common.php");
include_once("lib/cDB.php");
include_once("lib/cCPDAO.php");

$name = $_GET['name'];

$db = new cDB;
$c = new cCPDAO($db->getCon());


$arrList = $c->getSaleCntList($name);
if($arrList==NULL){
	$arrList = $c->getRecommand();
}
foreach($arrList as $i=>$v){
	$arrList[$i]['price'] = number_format($v['price']);
	$arrList[$i]['saleprice'] = number_format($v['saleprice']);
	$arrName = explode(" ",$name);
	foreach($arrName as $i2=>$t){
		$arrList[$i]['name'] = str_replace($t,"<span class='highlight'>".$t."</span>",$arrList[$i]['name']);
	}
}
$arrSiteList = $c->getCouponCntList(5);

$s = getSmarty();

$s->assign(name,$name);
$s->assign(arrList,$arrList);
$s->assign(arrSiteList,$arrSiteList);
$s->display(G_FRONT_VERSION.'find.htm');
?>